<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文字居中</title>
    <style>
        .main {
            width:400px;
            height:400px;
            margin:auto;
            background-color:skyblue;
            text-align:center;
            line-height: 400px;
        }
    </style>
</head>
<body>
    <div class="main">
        这是内容
    </div>
</body>
</html>